package com.isoft.farm.common.aspect;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;


@Aspect
@Component
public class SysTestAspect {
    private static Logger log= LoggerFactory.getLogger(SysTestAspect.class);
    @Pointcut("bean(sysUserServiceImpl)")
    public void logPointCut(){}
    @Around("logPointCut()")
    public Object around(ProceedingJoinPoint jp)throws Throwable {
        try {
            log.info("start:{}毫秒",System.currentTimeMillis());
            Object object = jp.proceed();
            log.info("end:{}毫秒",System.currentTimeMillis());
            return object;
        } catch (Throwable e) {
            log.error("after:{}毫秒",e.getMessage());
            return e;
        }
    }
}
